package com.cardone.platform.configuration.service;

import java.util.List;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.cache.Caches;
import com.cardone.common.dto.PaginationDto;
import com.cardone.platform.configuration.dto.DictionaryTypeDto;

/**
 * 字典类型服务
 *
 * @author yaohaitao
 */
public interface DictionaryTypeService {
	/**
	 * spring bean id
	 */
	String BEAN_ID = "com.cardone.platform.configuration.service.DictionaryTypeService";

	/**
	 * 保存:字典类型
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param saveDictionaryType
	 *          字典类型对象
	 *
	 * @return 字典类型对象
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = DictionaryTypeService.BEAN_ID, allEntries = true)
	<P> P saveByIdOrCode(final Class<P> mappedClass, final DictionaryTypeDto saveDictionaryType);

	/**
	 * 插入
	 *
	 * @param insertDictionaryType
	 *          字典类型对象
	 *
	 * @return 影响行数
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = DictionaryTypeService.BEAN_ID, allEntries = true)
	int insertByCode(final DictionaryTypeDto insertDictionaryType);

	/**
	 * 删除
	 *
	 * @param deleteDictionaryType
	 *          字典类型对象
	 *
	 * @return 影响行数
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = DictionaryTypeService.BEAN_ID, allEntries = true)
	int deleteByIds(final DictionaryTypeDto deleteDictionaryType);

	/**
	 * 更新
	 *
	 * @param updateDictionaryType
	 *          字典类型对象
	 *
	 * @return 影响行数
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = DictionaryTypeService.BEAN_ID, allEntries = true)
	int updateByCode(final DictionaryTypeDto updateDictionaryType);

	/**
	 * 查询
	 *
	 * @param readDictionaryType
	 *          字典类型对象
	 * @return 返回数据
	 */
	@Deprecated
	@Cacheable(value = SiteUrlService.BEAN_ID, key = Caches.KEY_1)
	Integer readByCodeNqIdForCount(final DictionaryTypeDto readDictionaryType);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param findDictionaryType
	 *          字典类型对象
	 * @return 返回对象
	 */
	@Cacheable(value = SiteUrlService.BEAN_ID, key = Caches.KEY_2)
	<P> P findById(final Class<P> mappedClass, final DictionaryTypeDto findDictionaryType);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param findDictionaryType
	 *          字典类型对象
	 *
	 * @return 返回对象
	 */
	@Deprecated
	@Cacheable(value = SiteUrlService.BEAN_ID, key = Caches.KEY_2)
	<P> P findByCodeOrId(final Class<P> mappedClass, final DictionaryTypeDto findDictionaryType);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param findListDictionaryType
	 *          字典类型对象
	 *
	 * @return 字典类型对象集合
	 */
	@Deprecated
	@Cacheable(value = SiteUrlService.BEAN_ID, key = Caches.KEY_2)
	<P> List<P> findListByLikeCode(final Class<P> mappedClass, final DictionaryTypeDto findListDictionaryType);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param parentId
	 *          父级标识
	 *
	 * @return 字典类型对象集合
	 */
	@Cacheable(value = SiteUrlService.BEAN_ID, key = Caches.KEY_2)
	<P> List<P> findListByParentId(final Class<P> mappedClass, final String parentId);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param parentCode
	 *          父级代码
	 *
	 * @return 字典类型对象集合
	 */
	@Cacheable(value = SiteUrlService.BEAN_ID, key = Caches.KEY_2)
	<P> List<P> findListByParentCode(final Class<P> mappedClass, final String parentCode);

	/**
	 * 分页
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param paginationDictionaryType
	 *          字典类型对象
	 *
	 * @return 字典类型分页对象
	 */
	@Cacheable(value = SiteUrlService.BEAN_ID, key = Caches.KEY_2)
	<P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final DictionaryTypeDto paginationDictionaryType);
}